package baseTest;

import java.util.Scanner;

public class frog {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int x = scanner.nextInt();
        int y = scanner.nextInt();
        int m = scanner.nextInt();
        int n = scanner.nextInt();
        int l = scanner.nextInt();
        int i = process(x, y, m, n, l);
        if (i == -1) {
            System.out.println("Impossible");
        } else {
            System.out.println(i);
        }
    }

    public static int process(int x, int y, int m, int n, int l) {

        if (x != y && m == n) {
            return -1;
        }
        int temp = 0;
        while (x != y) {
            if (x + m <= l) {
                x += m;
            } else {
                x = x + m - l;
            }
            if (y + n <= l) {
                y += n;
            } else {
                y = y + n - l;
            }
            temp++;
        }
        return temp;
    }
}
